package qq2564874169.tuaotuao.fx.utils;

import java.util.Random;

public class RandomUtil {
    public static String byRange(int min, int max) {
        Random r = new Random(System.nanoTime());
        return String.valueOf(min + r.nextInt((max - min)));
    }

    public static String byLength(int len) {
        int min = (int) Math.pow(10, len - 1);
        return byRange(min, min * 10);
    }

    public static int intByRange(int min, int max) {
        return Integer.parseInt(byRange(min, max));
    }

    public static int intByLength(int length) {
        return Integer.parseInt(byLength(length));
    }

    public static void main(String[] args) {
        int length = 6;
        int min = (int) Math.pow(10, length - 1);
        int max = ((int) Math.pow(10, length));
        for (int i = 0; i < 10; i++) {
            System.out.println(byLength(5));
        }
    }
}
